package com.andrew.servlet;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.andrew.dao.OrderDao;
import com.andrew.service.OrderService;
import com.andrew.service.impl.OrderServiceImpl;

public class ReceiveGoodsServlet extends HttpServlet {
	private OrderService orderService=new OrderServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		//设置编码
		req.setCharacterEncoding("UTF-8");
		resp.setCharacterEncoding("UTF-8");
		
		String  orderId=req.getParameter("orderId");
		System.out.println(orderId);
		try {
			orderService.receiveGoods(orderId);
			resp.getWriter().write("success");
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			resp.getWriter().write("false");
		}
	}
}
